//
//  CNM_Proxy.swift
//  swiftTXH
//
//  Created by Mac mini on 2020/12/28.
//  Copyright © 2020 Mac mini. All rights reserved.
//

import UIKit

// MARK: - Cell注册重用标识符
public protocol CNM_CellReuseId {
    static var cnm_reuseIdentifier: String { get }
}
extension CNM_CellReuseId {
    public static var cnm_reuseIdentifier: String {
        return String(describing: Self.self)
    }
}

// MARK: - Nib
public protocol CNM_Nib {
    static var cnm_nib: UINib { get }
}
extension CNM_Nib where Self: UIView {
    public static var cnm_nib: UINib {
        return UINib(nibName: String(describing: self), bundle: Bundle(for: self))
    }
    
    public static func cnm_loadNib(_ nibName: String? = nil) -> Self {
        let _nibName = nibName ?? String(describing: Self.self)
        return Bundle.main.loadNibNamed(_nibName, owner: nil, options: nil)?.last as! Self
    }
}
